//
//  CargoInformationVC.m
//  Logistics
//
//  Created by enzhoukeji on 2018/8/8.
//  Copyright © 2018年 puyue.com. All rights reserved.
//

#import "CargoInformationVC.h"
#import "CargoTVCell.h"
@interface CargoInformationVC ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *cargoTV;

@end

@implementation CargoInformationVC
-(UITableView *)cargoTV{
    if (!_cargoTV) {
        _cargoTV = [[UITableView alloc]initWithFrame:CGRectMake(0,  kMainTopHeight, kMainScreen_width , kMainScreen_height-kMainTopHeight - GTFixHeightFlaot(37)) style:UITableViewStyleGrouped];
        _cargoTV.backgroundColor = WGColor;
        _cargoTV.showsVerticalScrollIndicator = NO;
        _cargoTV.separatorStyle = UITableViewCellSeparatorStyleNone;
        _cargoTV.dataSource = self;
        _cargoTV.delegate = self;
    }
    return _cargoTV;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navTitle = @"货物信息";
    [self.view addSubview:self.cargoTV];
    // Do any additional setup after loading the view.
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 4;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        CargoTVCell *cell=[tableView dequeueReusableCellWithIdentifier:@"CargoTVCell"];
        if (!cell) {
            cell=[[CargoTVCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CargoTVCell"];
        }
        return cell;
    }else if(indexPath.section == 1){
        CargoTVCellSecond *cell=[tableView dequeueReusableCellWithIdentifier:@"CargoTVCellSecond"];
        if (!cell) {
            cell=[[CargoTVCellSecond alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CargoTVCellSecond"];
        }
        return cell;
    }else if(indexPath.section == 2){
        CargoTVCellThree *cell=[tableView dequeueReusableCellWithIdentifier:@"CargoTVCellThree"];
        if (!cell) {
            cell=[[CargoTVCellThree alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CargoTVCellThree"];
        }
        return cell;
    }else{
        CargoTVCellFour * cell=[tableView dequeueReusableCellWithIdentifier:@"CargoTVCellFour"];
        if (!cell) {
            cell=[[CargoTVCellFour alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CargoTVCellFour"];
        }
        return cell;
    }
    
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return nil;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    if (section == 3) {
        return GTFixHeightFlaot(60);
    }else{
        return 0.01;
    }
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    if (section == 3) {
        UIView * footView = [[UIView alloc]initWithFrame:CGRectMake(GTFixWidthFlaot(30), 0, kMainScreen_width - GTFixWidthFlaot(60), GTFixHeightFlaot(60))];
        UIButton * orderButton = [[UIButton alloc]initWithFrame:CGRectMake(GTFixWidthFlaot(30), GTFixHeightFlaot(30), kMainScreen_width - GTFixWidthFlaot(60), GTFixHeightFlaot(20))];
        [orderButton setTitle:@"接 单" forState:UIControlStateNormal];
        orderButton.backgroundColor = [UIColor colorWithRed:106/255.0 green:181/255.0 blue:231/255.0 alpha:1];
        orderButton.layer.cornerRadius = 4.0;
        [orderButton addTarget:self action:@selector(orderButtonClieck:) forControlEvents:UIControlEventTouchUpInside];
        [footView addSubview:orderButton];
        return footView;
    }else{
        return nil;
    }
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return GTFixHeightFlaot(10);
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return GTFixHeightFlaot(65);
}
-(void)orderButtonClieck:(UIButton *)btn {
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
